drawBoard = function(x, y){

	var width = 4;		//width of lines
	var offset = x/3;	//number of boxes squared

	var surface = dojox.gfx.createSurface("board", x, y);
	var groupBoard = surface.createGroup();
	
	for (var i = 0; i < 2; i++, offset += offset) {

		var shape = groupBoard.createPath({})
			.setStroke({color: "black", width: width })
			.moveTo(0,offset)
			.setAbsoluteMode(false)
			.hLineTo(x)
		;
	
		var shape =	groupBoard.createPath({})
			.setStroke({color: "black", width: width })
			.moveTo(offset,0)
			.setAbsoluteMode(false)
			.vLineTo(y)
		;
		//offset = offset + 100;
	}
	return surface;
};

var playTurns = function(state, whosTurn){

	var result = decideWhoWon(state);
	if (result < 3) return result;
	//decideSolution(state);
	//setAndPlaceMovees();
	playTurns(state, whosTurn); //problem with incrementing turns
	
};

var decideWhoWon = function(state) {
	var result;
	
	result = 2; //just fir testing
   //insert function to determine who the result was

	return result;
};

var playMatch = function(environment, state, whoGoesFirst) {

	result = playTurns(state, whoGoesFirst);


	
	// 3 is a not a result or a draw so keep playing

	//recursive function goes here

/*
	var groupO = surface.createGroup();
	var groupX = surface.createGroup();

	groupO.createCircle({cx: 50, cy: 50, r: 35})
		.setStroke({color: "black", width: 8})
	;

	groupX.createRect	({x: 0, y: 45, width: 100, height: 10})
	.setFill("black")
	;
	
	groupX.createRect	({x: 45, y: 0, width: 10, height: 100})
	.setFill("black")
	;
	
	groupX.setTransform([dojox.gfx.matrix.translate(200,200),dojox.gfx.matrix.rotategAt(45,50,50)]);
*/

};

var getState = function() {
};


var playTictactoe = function(numberOfGames,x,y) {
	var state = ['','','','','','','','',''];
	var players = [0,1];
	
	environment = drawBoard(x,y);

	for (var i = 0; i < numberOfGames; i++) {
	
		var result = playMatch(environment,state,players[i%2]);
		//tallyresult(result);
		
	};

};